{% load i18n %}
{% load filters %}

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Gym</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">

        <!-- Le styles -->
        <link href="{{ MEDIA_URL }}css/bootstrap.css" rel="stylesheet">
        <link href="{{ MEDIA_URL }}css/style.css" rel="stylesheet">

    </head>
    <body>
        <header>
            <!-- Static navbar -->
            <div class="navbar navbar-static-top">
                <div class="container">
                    <div class="navbar-header">
                        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                        <a class="navbar-brand" href="#">Project Gym</a>
                    </div>
                    <div class="navbar-collapse collapse">
                        <ul class="nav navbar-nav">
                            <li class="dropdown">
                                {% for mainMenu, menus in userMainMenus.items %}
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ mainMenu }}<b class="caret"></b></a>
                                    <ul class="dropdown-menu">
                                        {% for menu in menus %}
                                            {% url menu|key:'model' as model_url %}
                                            {% if model_url %}
                                                <li><a href="{{ model_url }}">{{ menu|key:'menu' }}</a></li>
                                            {% endif %}
                                        {% endfor %}
                                    </ul>
                                {% endfor %}

                            </li>
                        </ul>
                        {% get_available_languages as LANGUAGES %}
                        <section class="ct-select">
                            <form action="/i18n/setlang/" method="post" id="formlanguage">
                                {% csrf_token %}
                                <select class="language" tabindex="1" name="language" onchange='this.form.submit()'>
                                    {% for lang in LANGUAGES %}
                                        <option value="{{ lang.0 }}" {% if lang.0 == LANGUAGE_CODE %} selected="selected" {% endif %}>{{ lang.1 }}</option>
                                    {% endfor %}
                                </select>
                            </form>
                        </section>
                        <ul class="nav navbar-nav navbar-right">
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown">Bem-vindo(a), {{ request.user }} <b class="caret"></b></a>
                                <ul class="dropdown-menu">
                                    <li><a href="#">Editar perfil</a></li>
                                    <li><a href="{% url "core.views.logout_dashboard" %}">Logout</a></li>
                                </ul>
                        </ul>
                    </div><!--/.nav-collapse -->
                </div>
            </div>
        </header>